.class public Lrexsee/service/RexseePushHttpListener;
.super Ljava/lang/Object;
.source "RexseePushHttpListener.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field private static final EVENT_ONPUSHREFRESHFINISHED:Ljava/lang/String; = "onPushRefreshFinished"

.field private static final HTTP_DEFAULT_DURATION:I = 0x5

.field private static final HTTP_DEFAULT_TIMEOUT:I = 0xa

.field private static final INTERFACE_NAME:Ljava/lang/String; = "PushHttpListener"

.field private static final PUSH_HTTP_DEFAULT_ENCODING:Ljava/lang/String; = "GBK"


# instance fields
.field private final httpBrowser:Lrexsee/core/browser/Browser;

.field private final httpContext:Landroid/content/Context;

.field private final httpHandler:Landroid/os/Handler;

.field private httpRunnable:Ljava/lang/Runnable;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 2
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    const/4 v1, 0x0

    .line 43
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 41
    iput-object v1, p0, Lrexsee/service/RexseePushHttpListener;->httpRunnable:Ljava/lang/Runnable;

    .line 44
    iput-object p1, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    .line 45
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpHandler:Landroid/os/Handler;

    .line 46
    iput-object v1, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    .line 47
    invoke-static {p1}, Lrexsee/service/RexseePush;->initDatabase(Landroid/content/Context;)V

    .line 48
    return-void
.end method

.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 2
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 49
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 41
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpRunnable:Ljava/lang/Runnable;

    .line 50
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    .line 51
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpHandler:Landroid/os/Handler;

    .line 52
    iput-object p1, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    .line 53
    iget-object v0, p1, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onPushRefreshFinished"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 54
    iget-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    invoke-static {v0}, Lrexsee/service/RexseePush;->initDatabase(Landroid/content/Context;)V

    .line 55
    return-void
.end method

.method static synthetic access$0(Lrexsee/service/RexseePushHttpListener;)Landroid/os/Handler;
    .locals 1

    .prologue
    .line 40
    iget-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpHandler:Landroid/os/Handler;

    return-object v0
.end method

.method static synthetic access$1(Lrexsee/service/RexseePushHttpListener;)Ljava/lang/Runnable;
    .locals 1

    .prologue
    .line 41
    iget-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpRunnable:Ljava/lang/Runnable;

    return-object v0
.end method

.method static synthetic access$2(Lrexsee/service/RexseePushHttpListener;)[Lrexsee/service/HttpItem;
    .locals 1

    .prologue
    .line 71
    invoke-direct {p0}, Lrexsee/service/RexseePushHttpListener;->getItems()[Lrexsee/service/HttpItem;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$3(Lrexsee/service/RexseePushHttpListener;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 39
    iget-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method

.method static synthetic access$4(Lrexsee/service/RexseePushHttpListener;)Landroid/content/Context;
    .locals 1

    .prologue
    .line 38
    iget-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    return-object v0
.end method

.method public static getData(Landroid/content/Context;Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String;
    .locals 9
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "url"    # Ljava/lang/String;
    .param p2, "timeout"    # I
    .param p3, "encoding"    # Ljava/lang/String;

    .prologue
    .line 252
    :try_start_0
    new-instance v6, Ljava/net/URL;

    invoke-direct {v6, p1}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    invoke-virtual {v6}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v5

    check-cast v5, Ljava/net/HttpURLConnection;

    .line 253
    .local v5, "urlConnection":Ljava/net/HttpURLConnection;
    const-string v6, "GET"

    invoke-virtual {v5, v6}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V

    .line 254
    const/4 v6, 0x1

    invoke-virtual {v5, v6}, Ljava/net/HttpURLConnection;->setDoOutput(Z)V

    .line 255
    invoke-virtual {v5, p2}, Ljava/net/HttpURLConnection;->setConnectTimeout(I)V

    .line 256
    invoke-virtual {v5, p2}, Ljava/net/HttpURLConnection;->setReadTimeout(I)V

    .line 257
    const-string v6, "User-Agent"

    invoke-static {p0}, Lrexsee/core/application/RexseeApplication;->getUserAgent(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v5, v6, v7}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 258
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->connect()V

    .line 259
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v3

    .line 260
    .local v3, "inputStream":Ljava/io/InputStream;
    const/16 v6, 0x400

    new-array v0, v6, [B

    .line 261
    .local v0, "buffer":[B
    const/4 v1, 0x0

    .line 262
    .local v1, "bufferLength":I
    const-string v4, ""

    .line 263
    .local v4, "rtn":Ljava/lang/String;
    :goto_0
    invoke-virtual {v3, v0}, Ljava/io/InputStream;->read([B)I

    move-result v1

    if-gtz v1, :cond_0

    .line 266
    invoke-virtual {v3}, Ljava/io/InputStream;->close()V

    .line 267
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->disconnect()V

    move-object v6, v4

    .line 270
    .end local v0    # "buffer":[B
    .end local v1    # "bufferLength":I
    .end local v3    # "inputStream":Ljava/io/InputStream;
    .end local v4    # "rtn":Ljava/lang/String;
    .end local v5    # "urlConnection":Ljava/net/HttpURLConnection;
    :goto_1
    return-object v6

    .line 264
    .restart local v0    # "buffer":[B
    .restart local v1    # "bufferLength":I
    .restart local v3    # "inputStream":Ljava/io/InputStream;
    .restart local v4    # "rtn":Ljava/lang/String;
    .restart local v5    # "urlConnection":Ljava/net/HttpURLConnection;
    :cond_0
    new-instance v6, Ljava/lang/StringBuilder;

    invoke-static {v4}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v7

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    new-instance v7, Ljava/lang/String;

    const/4 v8, 0x0

    invoke-direct {v7, v0, v8, v1, p3}, Ljava/lang/String;-><init>([BIILjava/lang/String;)V

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v4

    goto :goto_0

    .line 269
    .end local v0    # "buffer":[B
    .end local v1    # "bufferLength":I
    .end local v3    # "inputStream":Ljava/io/InputStream;
    .end local v4    # "rtn":Ljava/lang/String;
    .end local v5    # "urlConnection":Ljava/net/HttpURLConnection;
    :catch_0
    move-exception v6

    move-object v2, v6

    .line 270
    .local v2, "e":Ljava/lang/Exception;
    const/4 v6, 0x0

    goto :goto_1
.end method

.method private getItems()[Lrexsee/service/HttpItem;
    .locals 11

    .prologue
    const/4 v10, 0x0

    const/4 v7, 0x0

    .line 72
    iget-object v5, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    const-string v6, "push.db"

    invoke-virtual {v5, v6, v10, v7}, Landroid/content/Context;->openOrCreateDatabase(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v2

    .line 73
    .local v2, "db":Landroid/database/sqlite/SQLiteDatabase;
    const-string v5, "SELECT * from push_http;"

    invoke-virtual {v2, v5, v7}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 74
    .local v1, "cursor":Landroid/database/Cursor;
    if-nez v1, :cond_0

    move-object v5, v7

    .line 87
    :goto_0
    return-object v5

    .line 75
    :cond_0
    invoke-interface {v1}, Landroid/database/Cursor;->getCount()I

    move-result v0

    .line 76
    .local v0, "count":I
    if-nez v0, :cond_1

    move-object v5, v7

    goto :goto_0

    .line 77
    :cond_1
    new-array v4, v0, [Lrexsee/service/HttpItem;

    .line 78
    .local v4, "rtn":[Lrexsee/service/HttpItem;
    const/4 v3, 0x0

    .local v3, "i":I
    :goto_1
    if-lt v3, v0, :cond_2

    .line 83
    :try_start_0
    invoke-interface {v1}, Landroid/database/Cursor;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 86
    :goto_2
    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteDatabase;->close()V

    move-object v5, v4

    .line 87
    goto :goto_0

    .line 79
    :cond_2
    invoke-interface {v1, v3}, Landroid/database/Cursor;->moveToPosition(I)Z

    .line 80
    new-instance v5, Lrexsee/service/HttpItem;

    invoke-interface {v1, v10}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v6

    const/4 v7, 0x1

    invoke-interface {v1, v7}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v7

    const/4 v8, 0x2

    invoke-interface {v1, v8}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v8

    const/4 v9, 0x3

    invoke-interface {v1, v9}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v9

    invoke-direct {v5, v6, v7, v8, v9}, Lrexsee/service/HttpItem;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    aput-object v5, v4, v3

    .line 78
    add-int/lit8 v3, v3, 0x1

    goto :goto_1

    .line 84
    :catch_0
    move-exception v5

    goto :goto_2
.end method


# virtual methods
.method public add(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 1
    .param p1, "url"    # Ljava/lang/String;
    .param p2, "userId"    # Ljava/lang/String;
    .param p3, "userPassword"    # Ljava/lang/String;

    .prologue
    .line 100
    const-string v0, "GBK"

    invoke-virtual {p0, p1, p2, p3, v0}, Lrexsee/service/RexseePushHttpListener;->add(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 101
    return-void
.end method

.method public add(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 6
    .param p1, "url"    # Ljava/lang/String;
    .param p2, "userId"    # Ljava/lang/String;
    .param p3, "userPassword"    # Ljava/lang/String;
    .param p4, "encoding"    # Ljava/lang/String;

    .prologue
    const-string v2, "\',\'"

    .line 103
    iget-object v2, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    iget-object v2, v2, Lrexsee/core/browser/Browser;->urlListeners:Lrexsee/core/browser/RexseeUrl;

    invoke-virtual {v2, p1}, Lrexsee/core/browser/RexseeUrl;->getAbsoluteUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    .line 104
    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v2

    invoke-virtual {v2}, Landroid/net/Uri;->getScheme()Ljava/lang/String;

    move-result-object v1

    .line 105
    .local v1, "scheme":Ljava/lang/String;
    const-string v2, "http"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_0

    const-string v2, "https"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_0

    .line 106
    iget-object v2, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/service/RexseePushHttpListener;->getInterfaceName()Ljava/lang/String;

    move-result-object v3

    const-string v4, "Wrong Scheme!"

    invoke-virtual {v2, v3, v4}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 120
    :goto_0
    return-void

    .line 109
    :cond_0
    iget-object v2, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    iget-object v2, v2, Lrexsee/core/browser/Browser;->domainWhiteList:Lrexsee/core/browser/clazz/DomainWhiteList;

    invoke-virtual {v2, p1}, Lrexsee/core/browser/clazz/DomainWhiteList;->isValidUrl(Ljava/lang/String;)Z

    move-result v2

    if-nez v2, :cond_1

    .line 110
    iget-object v2, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/service/RexseePushHttpListener;->getInterfaceName()Ljava/lang/String;

    move-result-object v3

    const-string v4, "Url not allowed."

    invoke-virtual {v2, v3, v4}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 114
    :cond_1
    :try_start_0
    iget-object v2, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    const-string v3, "push.db"

    const/4 v4, 0x0

    const/4 v5, 0x0

    invoke-virtual {v2, v3, v4, v5}, Landroid/content/Context;->openOrCreateDatabase(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    .line 115
    .local v0, "db":Landroid/database/sqlite/SQLiteDatabase;
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "DELETE FROM push_http WHERE url=\'"

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\';"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 116
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "INSERT INTO push_http VALUES (\'"

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\',\'"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\',\'"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\',\'"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\');"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 117
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 118
    .end local v0    # "db":Landroid/database/sqlite/SQLiteDatabase;
    :catch_0
    move-exception v2

    goto :goto_0
.end method

.method public contains(Ljava/lang/String;)Z
    .locals 4
    .param p1, "url"    # Ljava/lang/String;

    .prologue
    const/4 v3, 0x0

    .line 92
    invoke-direct {p0}, Lrexsee/service/RexseePushHttpListener;->getItems()[Lrexsee/service/HttpItem;

    move-result-object v1

    .line 93
    .local v1, "tmp":[Lrexsee/service/HttpItem;
    if-nez v1, :cond_0

    move v2, v3

    .line 97
    :goto_0
    return v2

    .line 94
    :cond_0
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_1
    array-length v2, v1

    if-lt v0, v2, :cond_1

    move v2, v3

    .line 97
    goto :goto_0

    .line 95
    :cond_1
    aget-object v2, v1, v0

    iget-object v2, v2, Lrexsee/service/HttpItem;->url:Ljava/lang/String;

    invoke-virtual {v2, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_2

    const/4 v2, 0x1

    goto :goto_0

    .line 94
    :cond_2
    add-int/lit8 v0, v0, 0x1

    goto :goto_1
.end method

.method public get()Ljava/lang/String;
    .locals 7

    .prologue
    const-string v6, "\""

    .line 131
    invoke-direct {p0}, Lrexsee/service/RexseePushHttpListener;->getItems()[Lrexsee/service/HttpItem;

    move-result-object v2

    .line 132
    .local v2, "tmp":[Lrexsee/service/HttpItem;
    if-nez v2, :cond_0

    const-string v3, ""

    .line 137
    :goto_0
    return-object v3

    .line 133
    :cond_0
    const-string v1, ""

    .line 134
    .local v1, "rtn":Ljava/lang/String;
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_1
    array-length v3, v2

    if-lt v0, v3, :cond_1

    .line 137
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "["

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "]"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    goto :goto_0

    .line 135
    :cond_1
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    if-nez v0, :cond_2

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "\""

    invoke-direct {v4, v6}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    aget-object v5, v2, v0

    iget-object v5, v5, Lrexsee/service/HttpItem;->url:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, "\""

    invoke-virtual {v4, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    :goto_2
    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 134
    add-int/lit8 v0, v0, 0x1

    goto :goto_1

    .line 135
    :cond_2
    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, ",\""

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    aget-object v5, v2, v0

    iget-object v5, v5, Lrexsee/service/HttpItem;->url:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, "\""

    invoke-virtual {v4, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    goto :goto_2
.end method

.method public get(Ljava/lang/String;)Ljava/lang/String;
    .locals 4
    .param p1, "url"    # Ljava/lang/String;

    .prologue
    const-string v3, ""

    .line 122
    iget-object v2, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    iget-object v2, v2, Lrexsee/core/browser/Browser;->urlListeners:Lrexsee/core/browser/RexseeUrl;

    invoke-virtual {v2, p1}, Lrexsee/core/browser/RexseeUrl;->getAbsoluteUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    .line 123
    invoke-direct {p0}, Lrexsee/service/RexseePushHttpListener;->getItems()[Lrexsee/service/HttpItem;

    move-result-object v1

    .line 124
    .local v1, "tmp":[Lrexsee/service/HttpItem;
    if-nez v1, :cond_0

    const-string v2, ""

    move-object v2, v3

    .line 128
    :goto_0
    return-object v2

    .line 125
    :cond_0
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_1
    array-length v2, v1

    if-lt v0, v2, :cond_1

    .line 128
    const-string v2, ""

    move-object v2, v3

    goto :goto_0

    .line 126
    :cond_1
    aget-object v2, v1, v0

    iget-object v2, v2, Lrexsee/service/HttpItem;->url:Ljava/lang/String;

    invoke-virtual {v2, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_2

    aget-object v2, v1, v0

    invoke-virtual {v2}, Lrexsee/service/HttpItem;->toString()Ljava/lang/String;

    move-result-object v2

    goto :goto_0

    .line 125
    :cond_2
    add-int/lit8 v0, v0, 0x1

    goto :goto_1
.end method

.method public getDuration()I
    .locals 8

    .prologue
    .line 160
    :try_start_0
    iget-object v4, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    const-string v5, "push.db"

    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-virtual {v4, v5, v6, v7}, Landroid/content/Context;->openOrCreateDatabase(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v1

    .line 161
    .local v1, "db":Landroid/database/sqlite/SQLiteDatabase;
    const-string v4, "SELECT duration from push_http_arguments;"

    const/4 v5, 0x0

    invoke-virtual {v1, v4, v5}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 163
    .local v0, "cursor":Landroid/database/Cursor;
    if-eqz v0, :cond_0

    invoke-interface {v0}, Landroid/database/Cursor;->getCount()I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v4

    if-nez v4, :cond_1

    .line 164
    :cond_0
    const/4 v3, 0x5

    .line 170
    .local v3, "rtn":I
    :goto_0
    :try_start_1
    invoke-interface {v0}, Landroid/database/Cursor;->close()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    .line 173
    :goto_1
    :try_start_2
    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteDatabase;->close()V

    move v4, v3

    .line 176
    .end local v0    # "cursor":Landroid/database/Cursor;
    .end local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .end local v3    # "rtn":I
    :goto_2
    return v4

    .line 166
    .restart local v0    # "cursor":Landroid/database/Cursor;
    .restart local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    :cond_1
    invoke-interface {v0}, Landroid/database/Cursor;->moveToFirst()Z

    .line 167
    const/4 v4, 0x0

    invoke-interface {v0, v4}, Landroid/database/Cursor;->getInt(I)I
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    move-result v3

    .restart local v3    # "rtn":I
    goto :goto_0

    .line 175
    .end local v0    # "cursor":Landroid/database/Cursor;
    .end local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .end local v3    # "rtn":I
    :catch_0
    move-exception v4

    move-object v2, v4

    .line 176
    .local v2, "e":Ljava/lang/Exception;
    const/4 v4, 0x5

    goto :goto_2

    .line 171
    .end local v2    # "e":Ljava/lang/Exception;
    .restart local v0    # "cursor":Landroid/database/Cursor;
    .restart local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .restart local v3    # "rtn":I
    :catch_1
    move-exception v4

    goto :goto_1
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 26
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 22
    iget-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    if-nez v0, :cond_0

    const/4 v0, 0x0

    :goto_0
    return-object v0

    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "PushHttpListener"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public getLastMessageId(Ljava/lang/String;)I
    .locals 8
    .param p1, "url"    # Ljava/lang/String;

    .prologue
    .line 202
    iget-object v4, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    if-eqz v4, :cond_0

    iget-object v4, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    iget-object v4, v4, Lrexsee/core/browser/Browser;->urlListeners:Lrexsee/core/browser/RexseeUrl;

    invoke-virtual {v4, p1}, Lrexsee/core/browser/RexseeUrl;->getAbsoluteUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    .line 204
    :cond_0
    :try_start_0
    iget-object v4, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    const-string v5, "push.db"

    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-virtual {v4, v5, v6, v7}, Landroid/content/Context;->openOrCreateDatabase(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v1

    .line 205
    .local v1, "db":Landroid/database/sqlite/SQLiteDatabase;
    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "SELECT id from push WHERE type=\'http\' and address=\'"

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, "\' ORDER BY date DESC LIMIT 1;"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    const/4 v5, 0x0

    invoke-virtual {v1, v4, v5}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 207
    .local v0, "cursor":Landroid/database/Cursor;
    if-eqz v0, :cond_1

    invoke-interface {v0}, Landroid/database/Cursor;->getCount()I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v4

    if-nez v4, :cond_2

    .line 208
    :cond_1
    const/4 v3, -0x1

    .line 214
    .local v3, "rtn":I
    :goto_0
    :try_start_1
    invoke-interface {v0}, Landroid/database/Cursor;->close()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    .line 217
    :goto_1
    :try_start_2
    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteDatabase;->close()V

    move v4, v3

    .line 220
    .end local v0    # "cursor":Landroid/database/Cursor;
    .end local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .end local v3    # "rtn":I
    :goto_2
    return v4

    .line 210
    .restart local v0    # "cursor":Landroid/database/Cursor;
    .restart local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    :cond_2
    invoke-interface {v0}, Landroid/database/Cursor;->moveToFirst()Z

    .line 211
    const/4 v4, 0x0

    invoke-interface {v0, v4}, Landroid/database/Cursor;->getInt(I)I
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    move-result v3

    .restart local v3    # "rtn":I
    goto :goto_0

    .line 219
    .end local v0    # "cursor":Landroid/database/Cursor;
    .end local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .end local v3    # "rtn":I
    :catch_0
    move-exception v4

    move-object v2, v4

    .line 220
    .local v2, "e":Ljava/lang/Exception;
    const/4 v4, -0x1

    goto :goto_2

    .line 215
    .end local v2    # "e":Ljava/lang/Exception;
    .restart local v0    # "cursor":Landroid/database/Cursor;
    .restart local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .restart local v3    # "rtn":I
    :catch_1
    move-exception v4

    goto :goto_1
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 1
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 30
    new-instance v0, Lrexsee/service/RexseePushHttpListener;

    invoke-direct {v0, p1}, Lrexsee/service/RexseePushHttpListener;-><init>(Lrexsee/core/browser/Browser;)V

    return-object v0
.end method

.method public getTimeout()I
    .locals 8

    .prologue
    .line 181
    :try_start_0
    iget-object v4, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    const-string v5, "push.db"

    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-virtual {v4, v5, v6, v7}, Landroid/content/Context;->openOrCreateDatabase(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v1

    .line 182
    .local v1, "db":Landroid/database/sqlite/SQLiteDatabase;
    const-string v4, "SELECT timeout from push_http_arguments;"

    const/4 v5, 0x0

    invoke-virtual {v1, v4, v5}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 184
    .local v0, "cursor":Landroid/database/Cursor;
    if-eqz v0, :cond_0

    invoke-interface {v0}, Landroid/database/Cursor;->getCount()I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v4

    if-nez v4, :cond_1

    .line 185
    :cond_0
    const/16 v3, 0xa

    .line 191
    .local v3, "rtn":I
    :goto_0
    :try_start_1
    invoke-interface {v0}, Landroid/database/Cursor;->close()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    .line 194
    :goto_1
    :try_start_2
    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteDatabase;->close()V

    move v4, v3

    .line 197
    .end local v0    # "cursor":Landroid/database/Cursor;
    .end local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .end local v3    # "rtn":I
    :goto_2
    return v4

    .line 187
    .restart local v0    # "cursor":Landroid/database/Cursor;
    .restart local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    :cond_1
    invoke-interface {v0}, Landroid/database/Cursor;->moveToFirst()Z

    .line 188
    const/4 v4, 0x0

    invoke-interface {v0, v4}, Landroid/database/Cursor;->getInt(I)I
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    move-result v3

    .restart local v3    # "rtn":I
    goto :goto_0

    .line 196
    .end local v0    # "cursor":Landroid/database/Cursor;
    .end local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .end local v3    # "rtn":I
    :catch_0
    move-exception v4

    move-object v2, v4

    .line 197
    .local v2, "e":Ljava/lang/Exception;
    const/16 v4, 0xa

    goto :goto_2

    .line 192
    .end local v2    # "e":Ljava/lang/Exception;
    .restart local v0    # "cursor":Landroid/database/Cursor;
    .restart local v1    # "db":Landroid/database/sqlite/SQLiteDatabase;
    .restart local v3    # "rtn":I
    :catch_1
    move-exception v4

    goto :goto_1
.end method

.method public refresh()V
    .locals 1

    .prologue
    const/4 v0, 0x1

    .line 224
    invoke-virtual {p0, v0, v0}, Lrexsee/service/RexseePushHttpListener;->refresh(ZZ)V

    .line 225
    return-void
.end method

.method public refresh(ZZ)V
    .locals 2
    .param p1, "progress"    # Z
    .param p2, "finishAlert"    # Z

    .prologue
    .line 227
    new-instance v0, Ljava/lang/Thread;

    new-instance v1, Lrexsee/service/RexseePushHttpListener$2;

    invoke-direct {v1, p0, p1, p2}, Lrexsee/service/RexseePushHttpListener$2;-><init>(Lrexsee/service/RexseePushHttpListener;ZZ)V

    invoke-direct {v0, v1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    .line 247
    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    .line 248
    return-void
.end method

.method public register()V
    .locals 4

    .prologue
    .line 58
    new-instance v0, Lrexsee/service/RexseePushHttpListener$1;

    invoke-direct {v0, p0}, Lrexsee/service/RexseePushHttpListener$1;-><init>(Lrexsee/service/RexseePushHttpListener;)V

    iput-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpRunnable:Ljava/lang/Runnable;

    .line 68
    iget-object v0, p0, Lrexsee/service/RexseePushHttpListener;->httpHandler:Landroid/os/Handler;

    iget-object v1, p0, Lrexsee/service/RexseePushHttpListener;->httpRunnable:Ljava/lang/Runnable;

    const-wide/16 v2, 0x3e8

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 69
    return-void
.end method

.method public remove(Ljava/lang/String;)V
    .locals 5
    .param p1, "url"    # Ljava/lang/String;

    .prologue
    .line 140
    iget-object v1, p0, Lrexsee/service/RexseePushHttpListener;->httpBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->urlListeners:Lrexsee/core/browser/RexseeUrl;

    invoke-virtual {v1, p1}, Lrexsee/core/browser/RexseeUrl;->getAbsoluteUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    .line 142
    :try_start_0
    iget-object v1, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    const-string v2, "push.db"

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-virtual {v1, v2, v3, v4}, Landroid/content/Context;->openOrCreateDatabase(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    .line 143
    .local v0, "db":Landroid/database/sqlite/SQLiteDatabase;
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "DELETE FROM push_http WHERE url=\'"

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "\';"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 144
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 147
    .end local v0    # "db":Landroid/database/sqlite/SQLiteDatabase;
    :goto_0
    return-void

    .line 145
    :catch_0
    move-exception v1

    goto :goto_0
.end method

.method public setDurationAndTimeout(II)V
    .locals 5
    .param p1, "durationMinutes"    # I
    .param p2, "timeoutSeconds"    # I

    .prologue
    .line 151
    :try_start_0
    iget-object v1, p0, Lrexsee/service/RexseePushHttpListener;->httpContext:Landroid/content/Context;

    const-string v2, "push.db"

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-virtual {v1, v2, v3, v4}, Landroid/content/Context;->openOrCreateDatabase(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    .line 152
    .local v0, "db":Landroid/database/sqlite/SQLiteDatabase;
    const-string v1, "DELETE FROM push_http_arguments;"

    invoke-virtual {v0, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 153
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "INSERT INTO push_http_arguments VALUES ("

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ","

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ");"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 154
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 157
    .end local v0    # "db":Landroid/database/sqlite/SQLiteDatabase;
    :goto_0
    return-void

    .line 155
    :catch_0
    move-exception v1

    goto :goto_0
.end method
